package com.wd.live.tool

import android.app.Activity
import android.content.Intent
import android.os.Parcelable
import android.widget.Toast
import androidx.fragment.app.Fragment

/**
 *@Author Nick.wu
 *Date 2023/8/15
 */

fun Activity.longToast(msg: String) {
    Toast.makeText(this, msg, Toast.LENGTH_LONG).show()
}


fun Fragment.longToast(msg: String) {
    Toast.makeText(this.requireContext(), msg, Toast.LENGTH_LONG).show()
}

inline fun <reified A : Activity> Activity.lunchActivity() {
    startActivity(Intent(this, A::class.java))
}

inline fun <reified A : Activity> Fragment.lunchActivity(key: String, obj: Parcelable) {
    val intent = Intent(requireActivity(), A::class.java)
    intent.putExtra(key, obj)
    requireActivity().startActivity(intent)
}